package uk.ac.cam.tcs40.sidnet.formal;

public enum Dietary { 

	NONE("None", "X"),
	VEGETARIAN_NO_FISH("Vegetarian (no fish)", "V"), 
	VEGETARIAN_FISH("Vegetarian (fish OK)", "W"), 
	VEGAN("Vegan", "E"), 
	NO_FISH("No fish", "F"), 
	NO_SHELLFISH("No shellfish", "S"), 
	NO_DAIRY("No dairy", "D"), 
	GLUTEN_FREE("Gluten free", "G"), 
	NO_NUTS("No nuts", "N"), 
	OTHER("Other - give details in the notes", "O");

	private final String m_Name;
	private final String m_Code;

	private Dietary(String friendlyName, String code) {
		m_Name = friendlyName;
		m_Code = code;
	};

	public String getCode() {
		return m_Code;
	}

	public static Dietary fromString(String code) {
		for (Dietary d : Dietary.values()) 
			if (d.getCode().equals(code))
				return d;
		return null;
	}

	@Override
	public String toString() {
		return m_Name;
	}
}